package com.lagou.controller;

import com.lagou.pojo.Article;
import com.lagou.pojo.ArticlePage;
import com.lagou.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Calendar;

/**
 * @author sxnan
 * @className LoginController
 * @description TODO
 * @date 2020/7/6
 */
@Controller
public class LoginController {

    @Autowired
    private ArticleService articleService;
    /**
     * 获取并封装当前年份跳转到登录页login.html
     */
    @RequestMapping("/list")
    public String toLoginPage(Model model, @RequestParam(value = "pageNo", defaultValue = "0") int pageNo, @RequestParam(value = "pageSize", defaultValue = "3") int pageSize) {
        Page<Article> articlePage= articleService.findArticlePage(pageNo, pageSize);
        model.addAttribute("articlePage",articlePage);
        return "client/index";
    }
}
